package com.villaday.idf.activity;


import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.Toolbar;
import android.view.View;

import com.villaday.idf.R;
import com.villaday.idf.adapter.HomeFacilityAdapter;
import com.villaday.idf.base.BaseActivity;
import com.villaday.idf.custom.LinDividerGridItem;
import com.villaday.idf.model.SheBeiEntity;
import com.villaday.idf.util.ToolBarUtil;

import java.util.ArrayList;

import butterknife.BindView;

/*
* 配套设施
* */
public class FacilitiesActivity extends BaseActivity {


    @BindView(R.id.toolbar_text)
    Toolbar toolbarText;
    @BindView(R.id.rv)
    RecyclerView rv;

    @Override
    protected int getViewResId() {
        return R.layout.activity_facilities;
    }

    @Override
    protected void init() {
        ArrayList<SheBeiEntity> data = getIntent().getParcelableArrayListExtra("data");
        ToolBarUtil.initToolBar(toolbarText, "配套设施", new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
        rv.setLayoutManager(new GridLayoutManager(this, 4,LinearLayoutManager.VERTICAL, false));
        rv.addItemDecoration(new LinDividerGridItem(this));
        HomeFacilityAdapter homeFacilityAdapter = new HomeFacilityAdapter(this);

        rv.setAdapter(homeFacilityAdapter);
        homeFacilityAdapter.setData(data);
    }
}
